<?php
/**
 * Defines Kodform_Validator_Required class
 *
 *
 * @copyright 	Copyright (c) 2006 Boris Tomic (kodmasin.net)
 * @category 	Kodform
 * @package 	Kodform
 * @author 		Boris Tomic
 * @license 	http://boris.kodmasin.net/kodform4:license The BSD License
 *
 */

require_once 'Kodform/Validator.php';

/**
 * required filed validator
 * 
 * this is little special validator and it is used by form elements in
 * special way. Form elements can have only one required validator.
 * It checks if form element has value. If it has it returns true if not false
 */
class Kodform_Validator_Required extends Kodform_Validator{
	public function __construct($message){
		parent::__construct($message);
	}
	/**
	 * just validating method
	 *
	 * @param mixed $value
	 * @return boolean true if valid false if not
	 * 
	 * @see Kodform_Validator
	 */
	function validate($value){
		if($value == "" || $value === null)
			return false;
		return true;
	}
}